// JavaScript Document
$().ready(function(){
				   $("#organisation-details-node-form").validate({
																 
					rules: {
						
						'field_orgn_depart[und]': { 
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
						},
						
						'field_orgn_type[und]':{
							required: true,
							maxlength: 255,
							chkbadchar:true,
							valuenotequals: '_none',
							},
							'title': { 
							required: true,
							minlength: 5,
							maxlength: 255,
							chkbadchar:true,
							splchar:true,
							},
							
					},
							
							messages: {
							'field_orgn_depart[und]':{
							required: 'Please Select Concerned Department',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							valuenotequals: 'Please Select Concerned Department',
							},
							'field_orgn_type[und]':{
							required: 'Please Select Organization Type',
							maxlength:  'Maximum 255 character only allowed',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',	
							valuenotequals: 'Please Select Organisation Type',
							},
							'title': { 
							required:  'Please enter Organization Name',
							minlength: 'Minimum 5 characters should be entered',
							maxlength: 'Maximum 255 character only allowed',
							chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
							splchar:'Special characters are not allowed'
							},
	
				}, 
					//errorLabelContainer: "#errormsg_container",
					 //focusInvalid: false,
   					invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //$("#announcements-node-form").create_errormsg_container('errormsg_container','announcements-node-form');
						}
							
							$('html, body').animate({
								scrollTop: $(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
										   
	});
});
